package io.jft.doll.ui.imagePreview

import android.os.Bundle
import android.view.View
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.g.base.ui.BaseActivity
import io.jft.doll.R
import io.jft.doll.databinding.ActivityImagePreviewBinding
import io.jft.doll.router.RouterPage
import org.greenrobot.eventbus.EventBus

/**
 * Created by G on 2017/10/18 0018.
 */
@Route(path = RouterPage.ImagePreview)
class ImagePreviewActivity : BaseActivity<ActivityImagePreviewBinding>() {
    override var isFullScreen: Boolean = true

    @JvmField
    @Autowired
    var image: String = ""

    @JvmField
    @Autowired
    var needRemove: Boolean = false

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        ARouter.getInstance().inject(this)
        setContentView(R.layout.activity_image_preview)
        contentView.data = this
        showContentView()
    }

    fun onRemoveClick(view: View) {
        EventBus.getDefault().post(OnPhotoRemoveEvent(image))
        finishAfterTransition()
    }

    fun onBackClick(view: View) {
        finishAfterTransition()
    }
}

class OnPhotoRemoveEvent(val url: String)